import java.math.BigInteger;

public class Calculator {
	
	public Calculator(){
	}
	
	public float nCr(float n, float r){
		
		return (fact(n).divide((fact(r).multiply(fact(n-r))))).floatValue();
	}
	
	public BigInteger fact(float n){
		
		BigInteger x = BigInteger.valueOf(1);
		
		for(int i = 1; i <= n; i++){
			x = x.multiply(BigInteger.valueOf(i));
		}
		return x;
	}
	
	public float hypergeometric(int lowerX, int upperX, int N, int n, int k){
		
		float x = 0;
		
		for(int i = lowerX; i <= upperX; i++){
			x = x + (nCr(k,i)*nCr(N-k, n-i))/nCr(N,n);
		}
		
		return x;
	}
	
	public float hypergeometric(int x, int N, int n, int k){
		
		return (nCr(k,x)*nCr(N-k, n-x))/nCr(N,n);
	}
	

	
}
